package com.longcai.service.customer;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.longcai.bean.ApiResult;
import com.longcai.entity.customer.ClyjUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * @author M
 * @description: TODO
 * @Title: CustomerService
 * @date 2019/3/14 10:20
 */
public interface CustomerService extends IService<ClyjUser> {

    /**
     * 根据名称查询用户信息
     *
     * @param name
     * @return
     */
    ClyjUser getName(String name);

    /**
     * 用户注册
     *
     * @param clyjUser
     * @return
     */
    ApiResult<ClyjUser> customerRegister(ClyjUser clyjUser, String userPId, Integer userPLevel, HttpServletRequest request);

    /**
     * 根据注册手机号查询是否已注册
     *
     * @param phone
     * @return
     */
    ApiResult isName(String phone);

    /**
     * 查询登录用户信息
     *
     * @param phone
     * @param pwd
     * @param request
     * @return
     */
    ApiResult customerLogin(String phone, String pwd, HttpServletRequest request);

    /**
     * 微信登录
     *
     * @param request
     * @param respons
     * @throws IOException
     */
    void wxLogin(HttpServletRequest request, HttpServletResponse respons);

    /**
     * 登录回调
     *
     * @param request
     * @param respons
     * @return
     * @throws IOException
     */
    String wxCallBack(HttpServletRequest request, HttpServletResponse respons);


    /**
     * 微信登录注册
     *
     * @param code
     * @param phone
     * @param inviteCode
     * @param openid
     * @param icon
     * @param token
     * @param pwd
     * @param request
     * @return
     */
    ApiResult wxRegister(String code, String phone, String inviteCode, String openid, String icon, String token, String pwd,String userPid, HttpServletRequest request);


    /**
     * 修改绑定手机号
     *
     * @param phone
     * @param newphone
     * @return
     */
    ApiResult updatePhone(String phone, String newphone);


    /**
     * 修改登录密码
     *
     * @param phone
     * @param pwd
     * @return
     */
    ApiResult updatePwd(String phone, String pwd);


    /**
     * 修改支付密码
     *
     * @param phone
     * @param newpayPwd
     * @return
     */
    ApiResult updatePaypwd(String phone, String newpayPwd);

    /**
     * 设置支付密码
     *
     * @param phone
     * @param payPwd
     * @return
     */
    ApiResult setPayPwd(String phone, String payPwd);

    /**
     * 个人信息
     *
     * @param token
     * @return
     */
    ApiResult perInformation(String token, HttpServletRequest request);
    /**
     * 微信信息
     *
     * @param token
     * @return
     */
    ApiResult perInformations(String token, HttpServletRequest request);
}
